<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>订单管理</title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<script>
	function checkDel(id) {
		if (window.confirm("是否删除该订单？")) {
			window.location.href = "/JEEBigHomework/order/delete?id=" + id;
		}
	}
</script>
</head>
<body>
	<div style="padding: 20px 0px 10px 140px;">
		<form:form modelAttribute="order" method="post"
			action="${pageContext.request.contextPath }/order/selectEml"
			class="form-inline">
			<label>查询Email</label>
			<form:input path="bemail" class="form-control" placeholder="Email"></form:input>
			<input type="submit" value="查询" class="btn btn-primary" />
			${selectMsg }	
		</form:form>
	</div>
	<div align="center">
		<div
			style="width: 100%; text-align: center; font-weight: bold; font-size: 20px; padding: 10px;">订单列表</div>

		<table class="table table-hover" style="width: 80%;">
			<tr>
				<th width="150px">#</th>
				<th width="150px">用户E-mail</th>
				<th width="100px">订单金额</th>
				<th width="100px">订单状态</th>
				<th width="150px">订单日期</th>
				<th width="100px">操作</th>
			</tr>

			<c:forEach var="order" items="${orderList}">
				<c:if test="${order.status == 0}">
					<tr class="warning">
						<td>${order.id}</td>
						<td>${order.bemail}</td>
						<td>${order.amount}</td>
						<td>未付款</td>
						<!-- <td><c:if test="${order.status == 0}" >未付款</c:if><c:if test="${order.status == 1}" >已付款</c:if></td> -->
						<td>${order.orderdate}</td>
						<td>&nbsp;</td>
					</tr>
				</c:if>
				<c:if test="${order.status == 1}">
					<tr class="success">
						<td>${order.id}</td>
						<td>${order.bemail}</td>
						<td>${order.amount}</td>
						<td>已付款</td>
						<!-- <td><c:if test="${order.status == 0}" >未付款</c:if><c:if test="${order.status == 1}" >已付款</c:if></td> -->
						<td>${order.orderdate}</td>
						<td><a href="javaScript:checkDel('${order.id}')"
							class="btn btn-danger">删除</a></td>
					</tr>
				</c:if>
			</c:forEach>
		</table>
	</div>

	<div align="center">
		<table class="table" style="width: 80%;">
			<tr>
				<td colspan="6"><c:forEach items="${pages}" var="i">
						<c:if test="${page == i }">
							<a href="${pageContext.request.contextPath }/order/select/${i}"
								target="center" style="pointer-events: none;"
								class="btn btn-primary">${i }</a>
								
						</c:if>
						
						<c:if test="${page != i }">
							<a href="${pageContext.request.contextPath }/order/select/${i}"
								target="center" class="btn btn-default">${i }</a>
						</c:if>
					</c:forEach></td>
			</tr>
		</table>
	</div>
</body>
</html>